package org.broadway.scripting;

/**
 * This interface is intended to be a facade to provide
 * an abstract layer for pluggable scripting engines.
 * Broadway provides an internal implementation for BSF.
 * Future implementation may wrap Java's inherent support
 * for scripting.
 * 
 * @author vladimir vivien
 *
 */
public interface ScriptEngine {
	/**
	 * This method is intended to add variables and variable values
	 * which will be made available at runtime to the script being
	 * executed.  So, in the script, the variable can be accessed 
	 * using the provided name.
	 * @param name - a string used to refer to the variable at runtime.
	 * @param value - the value of the variable.
	 */
	public void putVariable(String name, Object value);
	
	/**
	 * The eval() method is intended to provide functionality
	 * that will evaluate a string expression.
	 * @param exp - String expression
	 * @return - result of the evaluated expression
	 * @throws ScriptingException - thrown if anything should go wrong.
	 */
	public Object eval(String exp)  throws ScriptingException;
	
	/**
	 * This method is intended to allow execution of a script file.
	 * 
	 * @param fileName - full path of the script file.
	 * @return - result of the executed script file.
	 * @throws ScriptingException - thrown if anything goes wrong.
	 */
	public Object exec(String fileName) throws ScriptingException;
	
}
